<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php
echo "<title>".$title_for_layout."</title>";
echo $html->css('template');
echo $html->css('jquery-ui-1.8.9.custom');
echo $html->css('selectmenu');
echo $html->script('jquery');
echo $html->script('jquery.blockUI');
echo $html->script('jquery-ui-1.8.9.custom.min');
echo $html->script('jquery.ui.selectmenu');
echo $html->script('jquery.validate.pack');
echo $html->script('jquery.filter');
echo $html->script('jquery.numeric');
echo $scripts_for_layout;
?>
<script>
//document.body.style.cursor = "wait";
$(document).ajaxStart(function(){document.body.style.cursor = "wait";});
$(document).ajaxStop(function(){document.body.style.cursor = "default";});
//    $(document).ajaxStart(function(){$('#content').block({message:'Please wait...'});});
//    $(document).ajaxStop(function(){$('#content').unblock();});
function saveUI()
{
	        $.growlUI('Webukkit', 'Save succeed!');
}
$(function(){
$('select#langage').selectmenu({
	icons: [{find: '.avatar'}],
	bgImage: function() {return 'url(' + $(this).attr("title") + ')';},
	select: function(event, options) {
	var selectedLangage = options.value;
	<?php
		echo $js->request(array('controller'=>'users','action'=>'setlang'),array('data'=>'{lang:options.value}','dataExpression'=>true,'method'=>'post'));
	?>
	},
});
$('select#langage').selectmenu("value","<?php echo $lang; ?>");
});

</script>
</head>

<body>
<div id="page_bg">
<div id="header">
<div id="wrapper2">
<table cellspacing="0" cellpadding="0" class="logo">
<tbody><tr>
<td>
<h1><a href="<?php echo $this->webroot;?>"><?php echo $title_for_layout; ?><sup><?php if (!empty($version)) echo $version; ?></sup></a></h1>
</td>
</tr>
</tbody></table>
</div>
</div>

<div class="content_middle_bg">
<div class="content_top_bg">
<div class="content_bottom_bg">
<div id="top_menu">
<ul id="mainlevel-nav">
<?php
$login = $session->read('Auth.User.username');
if(!empty($login))
	{ ?>
	
	<li>
	<?php
	echo $js->link
	(
	'Dashboard',
	array('controller' => 'private','action'=>'view_status'),
	array(
	'update' => '#content',
	'class'=>'mainlevel-nav',
	)
		);
	?>
	</li>
	<li>
	<?php
	echo $this->Js->link
	(
	'Plugins GUI',
	array('controller' => 'plugins','action'=>'showgui'),
	array(
	'update' => '#content',
	'class'=>'mainlevel-nav',
	)
		);
	?>
	</li>
	<li>
	<?php
	echo $this->Js->link
	(
	'Edit plugins',
	array('controller' => 'plugins','action'=>'edit_plugins'),
	array(
	'update' => '#content',
	'class'=>'mainlevel-nav',
	)
		);
	?>
	</li>
	<li>
	<?php
	echo $this->Js->link
	(
	'Log',
	array('controller' => 'private','action'=>'view_log'),
	array(
	'update' => '#content',
	'class'=>'mainlevel-nav',
	)
		);
	?>
	</li>
	<li>
	<?php
	echo $this->Js->link
	(
	'Config',
	array('controller' => 'private','action'=>'view_config'),
	array(
	'update' => '#content',
	'class'=>'mainlevel-nav',
	)
		);
	?>
	</li>
	<div style="float:left">
	<?php
	echo $html->link($html->image("deconnexion.png",array('alt'=>'logout','title'=>'Logout')),array('controller'=>'users','action'=>'logout'),array('escape'=>false));
	?>
	</div>
	<?php }; ?>
	<div id='langagebar' style='float:right'>
<select name="langage" id="langage">
<option value="eng" class="avatar" title="<?php echo $this->webroot; ?>img/flag_united_kingdom.gif"></option>
<option value="fre" class="avatar" title="<?php echo $this->webroot; ?>img/flag_france.gif"></option>
</select>
</div>

</ul>	
</div>

<div><div class="clr"></div></div>

<div class="blog" id="content">
<?php echo $content_for_layout; ?>
</div>

</div>
</div>
</div>

<?php echo $this->element('sql_dump'); ?>
<?php echo $this->Js->writeBuffer(); ?>
</div>
<div id="footer"></div>
</body>
